package com.boot41.mapper;

import com.boot41.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author wxd
 * @version 1.0
 */
@Mapper
public interface UserMapper {
    @Select("select * from user")
    List<User> select();

    @Insert("insert into user values(null,#{username},#{password},#{nick})")
    void insert(User user);

    @Select("select * from user where username=#{username}")
    User selectByUsername(String username);

    @Delete("delete from user where id=#{id}")
    void deleteById(int id);

    @Select("select * from user where id=#{id}")
    User selectUserById(int id);

    @Update("update user set username=#{username},password=#{password},nick=#{nick} where id=#{id}")
    void updateUserById(User user);
}
